#include <iostream>
using namespace std;

int n;
int num = 1, fac_num = 1;
int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23}, len = 9;

void DFS(int dep, int now_num, int now_fac_num, int lastq = 100) {
  if (dep >= len) {
    return;
  }
  if (now_fac_num > fac_num || (now_fac_num == fac_num && now_num < num)) {
    num = now_num;
    fac_num = now_fac_num;
  }
  for (int t = 2; t <= lastq; t++) {
    if ((long long)now_num * prime[dep] > n) {
      break;
    }
    now_num *= prime[dep];
    DFS(dep + 1, now_num, now_fac_num * t, t);
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  cin >> n;
  DFS(0, 1, 1);
  cout << num << " " << fac_num << "\n";
  return 0;
}